package com.chenfubing.ps.entity.result;

import lombok.Data;

/**
 * @ClassName JsonResult
 * @Author chenfubing
 * @Date 2020/1/21
 **/
@Data
public class JsonResult<T> {

    private Integer code;
    private String msg;
    private T data;


    public JsonResult() {
        this.code = ErrorCode.SUCCESS.getCode();
        this.msg = ErrorCode.SUCCESS.getMsg();
    }

    public JsonResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public JsonResult(T data) {
        this();
        this.data = data;
    }

    public JsonResult(ErrorCode code) {
        this.code = code.getCode();
        this.msg = code.getMsg();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}